<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        
        .starWp {
            width: 109px;
            height: 21px;
            background: url("img/star.png");
            background-position-y: -123px;
        }
        
        .star-5 {
            background-position: 0 -1px;
        }
        
        .star-4 {
            background-position: 0 -25px;
        }
        
        .star-3 {
            background-position: 0 -50px;
        }
        
        .star-2 {
            background-position: 0 -75px;
        }
        
        .star-1 {
            background-position: 0 -100px;
        }
        
        .starWp>span {
            float: left;
            width: 21px;
            height: 21px;
        }
    </style>
</head>

<body>

    <h5>当前星级：</h5>
    <div class="starWp">
        <span></span>
        <span></span>
        <span></span>
        <span></span>
        <span></span>
    </div>


    <script src="../jQuery库/jquery-3.1.0.js"></script>
    <script>
        $(".starWp>span").mouseenter(function() {
            let index = $(this).index();
            $(".starWp").attr("class", `starWp star-${index+1}`)
        })
    </script>
</body>

</html>